package com.example.springboot01.service.impl;

import com.example.springboot01.entity.TUser;
import com.example.springboot01.service.TUserService;
import com.example.springboot01.dao.TUserDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import javax.persistence.criteria.CriteriaBuilder;
import java.util.List;
import java.util.Map;

/**
 * (TUser)表服务实现类
 *
 * @author makejava
 * @since 2022-12-22 18:56:31
 */
@Service
public class TUserServiceImpl implements TUserService {
   @Resource
   private TUserDao tUserDao;

   @Override
   public List<TUser> queryAll() {
      return tUserDao.queryAll();
   }

   @Override
   public boolean addUser(TUser tUser) {
      int i = tUserDao.addUser(tUser);
      return i>0?true:false;
   }

   @Override
   public List<TUser> findByPage(Integer page, Integer limit) {
      //
      int page1=0;
      if(page!=null){
         page1=page;
      }
      int pageNum=0;
      if(limit!=null){
         pageNum=limit;
      }
      int start = (page1 - 1) * pageNum;
      return tUserDao.findByPage(start,pageNum);
   }
}

